package com.cls.business.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.cls.business.entity.TopicPlan;
import com.cls.common.entity.QueryRequest;
import com.github.pagehelper.PageInfo;

import java.util.List;

/**
 * 课题计划表 Service接口
 *
 * @author wmm
 * @date 2020-11-11 10:45:55
 */
public interface ITopicPlanService extends IService<TopicPlan> {
    /**
     * 查询（分页）
     *
     * @param request   QueryRequest
     * @param topicPlan topicPlan
     * @return PageInfo<TopicPlan>
     */
    PageInfo<TopicPlan> findTopicPlans(QueryRequest request, TopicPlan topicPlan);

    /**
     * 查询（所有）
     *
     * @param topicPlan topicPlan
     * @return List<TopicPlan>
     */
    List<TopicPlan> findTopicPlans(TopicPlan topicPlan);

    TopicPlan findById(Long id);

    /**
     * 新增
     *
     * @param topicPlan topicPlan
     */
    void createTopicPlan(TopicPlan topicPlan);

    /**
     * 修改
     *
     * @param topicPlan topicPlan
     */
    void updateTopicPlan(TopicPlan topicPlan);

    /**
     * 删除
     *
     * @param ids
     */
    void deleteTopicPlans(String[] ids);

    /**
     * 根据SelectNoticeId查询
     *
     * @param selectNoticeId
     * @return
     */
    TopicPlan selectBySelectNoticeId(Long selectNoticeId);

    /**
     * 根据ApplyNoticeId查询
     *
     * @param applyNoticeId
     * @return
     */
    TopicPlan selectByApplyNoticeId(Long applyNoticeId);

    TopicPlan selectByPeriod(String period);

    void updateTopicPlanStatusCode(TopicPlan topicPlan);

    /**
     * 魏起成根据年份更新计划状态
     *
     * @param year
     */
    void updateStatusCodeByYear(Integer year, String statusCode);

    boolean endClassifyTopic(TopicPlan plan);


    boolean endClassifyEntrustTopic(TopicPlan plan);

    boolean endAssignTopicPlan(TopicPlan plan);

    /**
     * 根据年份查询年度课题
     *
     * @param year
     * @return
     */
    TopicPlan selectAnnualByYear(String year);


    boolean assignEntrust(Long planId, Long declarePlanId);

    boolean unAssignEntrusts(Long declarePlanId);

    /**
     * 魏起成 根据classifyCode  statusCode 与 未定级数量=0   查询计划
     *
     * @return
     */
    List<TopicPlan> findTopicByClassifyCodeAndNoLevel();

    /**
     * 根据ApplyNoticeId查询
     *
     * @param preItemNoticeId
     * @return
     */
    TopicPlan selectByPreItemNoticeId(Long preItemNoticeId);

    /**
     * 根据concludeNoticeId查询
     *
     * @param concludeNoticeId
     * @return
     */
    TopicPlan selectByConcludeNoticeId(Long concludeNoticeId);

    boolean resumeInitialization(TopicPlan plan);

    /**
     * 根据itemNoticeId查询
     *
     * @param itemNoticeId
     * @return
     */
    TopicPlan selectItemNoticeId(Long itemNoticeId);


    int sendReviewEmail(TopicPlan plan);

    TopicPlan selectNoticeByConcludeFinishNoticeId(Long concludeFinishNoticeId);


}
